package com.android.hedgehog;

import java.util.List;

import com.android.hedgehog.framework.Game;
import com.android.hedgehog.framework.Graphics;
import com.android.hedgehog.framework.Screen;
import com.android.hedgehog.framework.Input.TouchEvent;

public class Records extends Screen {

	public Records(Game game) {
		super(game);

	}

	@Override
	public void update(float deltaTime) {
		Graphics g = game.getGraphics();
		List<TouchEvent> touchEvents = game.getInput().getTouchEvents();

		int len = touchEvents.size();

		for (int i = 0; i < len; i++) {
			TouchEvent event = touchEvents.get(i);
			if (event.type == TouchEvent.TOUCH_UP && event.y < 400) {

				if (event.x < 160 && event.y < 200) { // if "IQ rating" touched
					// game.setScreen(new ...(game));
					if (Settings.soundEnabled)
						Assets.bitten.play(1);
					return;
				}
				if (event.x > 160 && event.y < 200) { // if "HighScores" touched
					//game.setScreen(new HighScores(game));
					game.setScreen(new TesterScreen(game));
					if (Settings.soundEnabled)
						Assets.bitten.play(1);
					return;
				}
				if (event.x < 160 && event.y > 200 && event.y < 400) { // Rank
					//game.rankScreen();
					game.setScreen(new GlobalRank2(game));
					if (Settings.soundEnabled)
						Assets.bitten.play(1);
					return;
				}
				if (event.x > 160 && event.y > 200 && event.y < 400) {//4th Screen
					game.setScreen(new PersonalInformation(game));
					if (Settings.soundEnabled)
						Assets.bitten.play(1);
					return;
				}

			}
			if (event.type == TouchEvent.TOUCH_UP && event.x < 60
					&& event.y > 420) { // if home button touched
				game.setScreen(new MainMenu2(game));
				if (Settings.soundEnabled)
					Assets.click.play(1);
			}
		}

	}

	@Override
	public void present(float deltaTime) {
		Graphics g = game.getGraphics();
		g.drawPixmap(Assets.blackbackground, 0, 0);
		g.drawPixmap(Assets.whitearrowbuttons, 0, 420, 120, 0, 60, 60);
		g.drawPixmap(Assets.recordbanners, 0, 0, 0, 0, 160, 200);
		g.drawPixmap(Assets.recordbanners, 160, 0, 160, 0, 160, 200);
		g.drawPixmap(Assets.recordbanners, 0, 200, 320, 0, 160, 200);
		g.drawPixmap(Assets.recordbanners, 160, 200, 480, 0, 160, 200);
	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub

	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub

	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub

	}

}
